home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
aspgue1a
/
default.asp
< prev
next >
Wrap
Text File
|
1999-09-22
|
5KB
|
157 lines
<html>
<head>
<title>Kathi's Guestbook</title>
<meta http-equiv="expires" content="0">
<style>
<!--
a:link, a:visited {color:#C5BE60; font-weight:bold;}
a:active {color=yellow; background: firebrick; font-size: 100%; font-weight:bold;}
a:hover {color:yellow; font-weight:bold;}
//-->
</style>
<!-- scripting , html copyright 1998 Kathi O'Shea ------->
<!-- email info@web-savant for custom web development --->
<!-- see readme.txt in zip file for modification and ---->
<!-- redistribution info -------------------------------->
</head>
<body bgcolor="black" text="#C5BE60" topmargin=0 leftmargin=0>
<center>
<font face="times new roman">
<h1><i>Kathi's Guestbook</i></h1><p>
</font>
<% PageNo = request("page")
If PageNo="" then
%>
<font face="arial" size=3>
<a href="sign.asp">Sign the Guestbook</a>
<a href="<%= Request.ServerVariables("HTTP_REFERER")%>">Back to Referring Page</a>
</font>
<p>
<font face='arial' size=2>Would you like to use this guestbook on your ASP-enabled site?
<br><a href="guestbook.zip">Download the guestbook files</a><p>
<%
PageNo=1
ElseIf PageNo=1 then
%>
<font face="arial" size=3>
<a href="sign.asp">Sign the Guestbook</a>
<p>
<font face='arial' size=2>Would you like to use this guestbook on your ASP-enabled site?
<br><a href="guestbook.zip">Download the guestbook files</a><p>
<%
Else
%>
<font face="arial" size=3>
<a href="sign.asp">Sign the Guestbook</a>
<p>
<%
End If
set conn = server.createobject("adodb.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
' set the actual path to the guestbook below - this example
' assumes that the guestbook is in the web server root
DSNtemp=dsntemp & "DBQ=" & server.mappath("/guestbook.mdb")
conn.Open DSNtemp
sqlstmt = "SELECT * from Guestbook ORDER BY PostDate DESC"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sqlstmt, conn, 3, 3
TotalRecs = rs.recordcount
rs.Pagesize=10
TotalPages = cInt(rs.pagecount)
rs.absolutepage=PageNo
If PageNo = 1 then
response.write "<br><Font face='arial' size=2>There are " & TotalRecs & " entries in " & TotalPages & " pages</font>"
End If
If rs.eof then
response.write "<p><br><center><font face='arial'><b>There are no entries in the guestbook.</b>"
response.write "<br><a href='sign.asp'>Sign the Guestbook</a></font></center>"
response.end
End If
x = 0
For x = 1 to 10
If rs.eof then
Exit For
Else
When = rs("PostDate")
Name = rs("Name")
Name = Replace(Name,"''","'")
City = rs("City")
State = rs("State")
Country = rs("Country")
Email = rs("Email")
URL = rs("URL")
If IsEmpty(URL) or URL = "" then
Link = "no URL given"
Else
Link = "<a href='" & URL & "'>" & URL & "</a>"
End If
Comments = rs("Comments")
Comments = replace(Comments, "''", "'")
Start = rs("PostDate")
%>
<table width=600 border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=3><font face="arial" size=2><%= When %></td></tr>
<tr>
<td colspan=3 bgcolor="#C5BE60"><font face="arial" size=2 color="#000000">
<b><%= Comments %></b></font>
</td>
</tr>
<tr>
<td width=125 valign="top">
<font face="arial" size=1>
<%
If IsEmpty(Email) or Email="" then
response.write(Name)
Else
response.write "<a href='mailto:" & Email & "'>" & Name & "</a>"
End If
%>
</font>
</td>
<td width=200 valign="top"><font face="arial" size=1><i><%= City %>
<%= State %> <%= Country %></i>
</td>
<td width=275 align="right" valign="top">
<font face="arial" size=1><%= Link %>
</font>
</td>
</tr>
</table>
<br>
<%
rs.MoveNext
End If
Next
response.write "<table width=300 border=0><tr>"
response.write "<td align='center'>"
If PageNo > 1 then
response.write "<form method='post' action='default.asp'>"
response.write "<input type='hidden' name='Page' value='" & PageNo-1 & "'>"
response.write "<font face='arial' size=2>"
response.write "<input type='submit' value='<< Prev'></form>"
Else
response.write " "
End If
response.write "</td><td align='center'>"
If NOT rs.eof then
response.write "<form method='post' action='default.asp'>"
response.write "<input type='hidden' name='Page' value='" & PageNo+1 & "'>"
response.write "<font face='arial' size=2>"
response.write "<input type='submit' value='Next >>'></form>"
Else
response.write " "
End If
response.write "</td></tr></table>"
conn.close
set conn = nothing
%>
</center>
</body>
</html>